package com.digitalchina.lxnsy.viewholder;

import android.view.ViewGroup;
import android.widget.TextView;

import com.digitalchina.lxnsy.R;
import com.digitalchina.lxnsy.entity.PriceTabV2VO;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;

/**
 * ================================================
 * 项目名称：BigData
 * 类描述：
 * 包名：com.digitalchina.bigdata.viewholder
 * 创建人：郑皓
 * 创建时间：2017年7月27日 19:54
 * 修改备注：
 * ================================================
 */

public class PriceTabV2Holder extends BaseViewHolder<PriceTabV2VO> {

    private TextView priceTabProvince;
    private TextView priceTabPerDayPrice;
    private TextView priceTabHighsLows;


    public PriceTabV2Holder(ViewGroup parent) {
        super(parent, R.layout.item_price_tab);
        priceTabProvince = $(R.id.price_tab_province);
        priceTabPerDayPrice = $(R.id.price_tab_perDayPrice);
        priceTabHighsLows = $(R.id.price_tab_highsLows);
    }

    @Override
    public void setData(PriceTabV2VO data) {
        super.setData(data);

        priceTabProvince.setText(data.getRegionInfo() + "");
        priceTabPerDayPrice.setText(data.getPerDayPrice() + "");

        //涨跌 1跌 2涨 0持平
        switch (data.getHighsLows()) {
            case "0":
                priceTabHighsLows.setTextColor(getContext().getResources().getColor(R.color.colorOrange));
                priceTabHighsLows.setText("平稳");
                break;
            case "1":
                priceTabHighsLows.setTextColor(getContext().getResources().getColor(R.color.colorGreen));
                priceTabHighsLows.setText(data.getHighsLowsRange() + "%");
                break;
            case "2":
                priceTabHighsLows.setTextColor(getContext().getResources().getColor(R.color.colorRed));
                priceTabHighsLows.setText("+" + data.getHighsLowsRange() + "%");
                break;
        }

    }

}
